#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

using std::cout;
using std::endl;
using std::vector;
using std::reverse_iterator;
using std::ostream_iterator;
using std::copy;

void test()
{
    vector<int> number = {1, 3, 5, 7, 9, 8, 4, 2};
    copy(number.begin(), number.end(), 
         ostream_iterator<int>(cout, "  "));
    cout << endl;

    //反向迭代器
    vector<int>::reverse_iterator rit;
    for(rit = number.rbegin(); rit != number.rend(); ++rit)
    {
        cout << *rit << "  ";
    }
    cout << endl;
}

int main(int argc, char **argv)
{
    test();
    return 0;
}

